/**
 * Copyright (C), 2001-2031, www.bosssoft.com.cn
 * FileName: EncryptSimpleUtil.java
 * Author: Camera
 * Date: 2024/8/4 18:37
 * Description:
 * <p>
 * History:
 * Date          Author   Version  Desc
 * 2024-01-01    bosssoft  1.0.0   initialize this file
 */
package com.bosssoft.common.token;


import org.apache.commons.codec.digest.Md5Crypt;
import org.apache.commons.codec.digest.Sha2Crypt;

/**
 * @className: EncryptSimpleUtil
 * @description: 加密工具类，包含md5和sha2加密
 * @author: Camera
 * @date: 2024/8/418:37
 * @since 1.0
 **/
public abstract class EncryptSimpleUtil {
    /**
     * md5加密
     *
     * @param key  加密内容
     * @param salt 盐
     * @return 加密成功的内容
     */
    public static String md5(byte[] key, String salt) {
        return Md5Crypt.apr1Crypt(key, salt);
    }

    /**
     * sha2加密 调用 apache common完成
     *
     * @param key  加密内容
     * @param salt 盐
     * @return 加密成功的内容
     */
    public static String sha2(byte[] key, String salt) {
        return Sha2Crypt.sha256Crypt(key, salt);
    }

}
